<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title> 2-6 JavaScript-关闭窗口（window.close）</title>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <script type="text/javascript">
//    var  mywin=window.open("http://www.imooc.com");
//    mywin.close();

        var mywin=window.open("http://www.imooc.com");
        var a=confirm("我刚开始偷偷的打开了一个慕课网,要关掉吗?");
        if(a==true){
            mywin.close();
        }else{
            alert("新窗口已经打开了,不信你看")
        }
    </script>
</head>

<body>
<div align="center">
    <p><a href="../index.php#js" class="fontSize" title="点击进入该目录">目录</a></p>
</div>

<!--<input name="button" type="button" onclick="JavaScript:mywin.close();" value="点击我,关闭新窗口!" />-->

</body>
</html>
